<?php

namespace App\Http\Controllers\Common;

use App\Exceptions\ApiException;
use App\Http\Controllers\Controller;
use App\Models\Common\Area;
use App\Service\EmailService;
use Illuminate\Http\File;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use phpDocumentor\Reflection\Types\Null_;

/**
 * @group 邮件
 * Class AreaController
 * @package App\Http\Controllers\Common
 */
class EmailController extends Controller
{

    /**
     * sendEmail 发邮件
     * @time:2020/2/9-12:43
     * @author:dongdong
     * @queryParam email required The id of the location.
     * @queryParam content required The id of the location.
     * @queryParam title required The id of the location.

     * @response {
     * "data": {
     * },
     * "status_code": 200,
     * "message" : "success"
     * }
     */
    public function sendEmail(Request $request)
    {
        $request->validate([
            'email' => 'required|email',
            'content' => 'required',
            'title' => 'required'
        ]);
        $email = $request->get('email');
        $content = $request->get('content');
        $title = $request->get('title');
        $res = (new EmailService())->sendMail($title, $content,  [$email]);
        return returnData($res);
    }


}
